import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description: 牛客网: HJ27 查找兄弟单词
 * <a href="https://www.nowcoder.com/practice/03ba8aeeef73400ca7a37a5f3370fe68?tpId=37&tqId=21250&ru=/exam/oj">...</a>
 * User: DELL
 * Date: 2023-05-17
 * Time: 20:54
 */
public class Main {
    /**
     * 本题的解题思路没有什么难点,重要的就是学习一些小技巧
     * 1. 对于 ArrayList 和 LinkedList 等的实现 Collections 的接口,都可以
     *    使用 Collections.sort 来实现排序
     * 2. 比较一个单词是否为其兄弟单词的时候,可以将原单词转化为字符串数组,之后利用
     *     Arrays.sort 方法排序后,比较是否相等即可
     * @param args
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String[] words = new String[n];
        for (int i = 0; i < n; i++) {
            words[i] = scanner.next();
        }
        String word = scanner.next();
        int k = scanner.nextInt();
        //记录兄弟单词
        ArrayList<String> brotherWords = new ArrayList<>();
        for (String otherWord : words) {
            if (isBrother(word,otherWord)) {
                brotherWords.add(otherWord);
            }
        }
        //输出兄弟单词个数
        System.out.println(brotherWords.size());
        if (k <= brotherWords.size()) {
            Collections.sort(brotherWords);
            System.out.println(brotherWords.get(k-1));
        }
    }

    /**
     * 判断 otherWord 是否为 word 的兄弟单词
     * @param word
     * @param otherWord
     * @return
     */
    private static boolean isBrother(String word, String otherWord) {
        if (word.length() != otherWord.length()|| word.equals(otherWord)) {
            return false;
        }
        char[] word1 = word.toCharArray();
        char[] word2 = otherWord.toCharArray();
        Arrays.sort(word1);
        Arrays.sort(word2);
        return Arrays.equals(word1, word2);
    }
}
